listview: Reset listitems' CSS animations when rebinding
authorBenjamin Otte <otte@redhat.com>
Sat, 29 Sep 2018 20:38:09 +0000 (22:38 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 30 May 2020 23:26:45 +0000 (19:26 -0400)
This way, newly displayed rows don't play an unselect animation (text
fading in) when they are unselected, but the row was previously used for
a selected item.

gtk/gtklistitem.c

index a11b8b3cc8b2529dc168be1d97e1e10fa41dbe66..411d187b8904b7ede9b4626920c7c4e78674a42a 100644 (file)
 #include "gtklistitemprivate.h"
 
 #include "gtkbinlayout.h"
+#include "gtkcssnodeprivate.h"
 #include "gtkintl.h"
 #include "gtkwidget.h"
+#include "gtkwidgetprivate.h"
 
 /**
  * SECTION:gtklistitem
@@ -325,6 +327,8 @@ gtk_list_item_set_item (GtkListItem *self,
   if (item)
     self->item = g_object_ref (item);
 
+  gtk_css_node_invalidate (gtk_widget_get_css_node (GTK_WIDGET (self)), GTK_CSS_CHANGE_ANIMATIONS);
+
   g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ITEM]);
 }